package com.swf.jpa.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.swf.jpa.framework.annotation.InterceptorList;
import com.swf.jpa.interceptor.CommonInterceptor;
import com.swf.jpa.model.Tyebaccoinfo;
import com.swf.jpa.model.Tyebpayinrequest;
import com.swf.jpa.model.Tyebpayinresult;
import com.swf.jpa.model.Tyebpayoutrequest;
import com.swf.jpa.service.TyebaccoinfoService;
import com.swf.jpa.service.TyebpayinrequestService;
import com.swf.jpa.service.TyebpayinresultService;
import com.swf.jpa.service.TyebpayoutrequestService;


@Controller
@RequestMapping("query")
public class QueryController {
	@Autowired
	private TyebaccoinfoService tyebaccoinfoService; 
	@Autowired
	private TyebpayinrequestService tyebpayinrequestService; 
	@Autowired
	private TyebpayoutrequestService tyebpayoutrequestService; 
	@Autowired
	private TyebpayinresultService tyebpayinresultService; 
	
	
	@InterceptorList(names=CommonInterceptor.class)
	@RequestMapping("tyebaccoinfo")
	public Tyebaccoinfo findByVcTradeacco(Tyebaccoinfo tyebaccoinfo) {
		Tyebaccoinfo result = tyebaccoinfoService.findByVcTradeacco(tyebaccoinfo.getVcTradeacco());
		System.out.println(result);
		return result;
	}
	@InterceptorList(names=CommonInterceptor.class)
	@RequestMapping("tyebpayinrequest")
	public Tyebpayinrequest findByRequestNo(Tyebpayinrequest request) {
		Tyebpayinrequest result = null;
		if (request.getVcPartnerrequestno()!=null){
			result = tyebpayinrequestService.findByVcPartnerrequestno(request.getVcPartnerrequestno());
		}
		if (result == null && request.getVcRequestno()!=null){
			result = tyebpayinrequestService.findByVcRequestno(request.getVcRequestno());
		}
		System.out.println(result);
		return result;
	}
	@InterceptorList(names=CommonInterceptor.class)
	@RequestMapping("tyebpayoutrequest")
	public Tyebpayoutrequest findByRequestNo(Tyebpayoutrequest request) {
		Tyebpayoutrequest result = null;
		if (request.getVcPartnerrequestno()!=null){
			result = tyebpayoutrequestService.findByVcPartnerrequestno(request.getVcPartnerrequestno());
		}
		if (result == null && request.getVcRequestno()!=null){
			result = tyebpayoutrequestService.findByVcRequestno(request.getVcRequestno());
		}
		System.out.println(result);
		return result;
	}
	@InterceptorList(names=CommonInterceptor.class)
	@RequestMapping("tyebpayinresult")
	public Tyebpayinresult findByRequestNo(Tyebpayinresult request) {
		Tyebpayinresult result = null;
		if (request.getVcPartnerrequestno()!=null){
			result = tyebpayinresultService.findByVcPartnerrequestno(request.getVcPartnerrequestno());
		}
		if (result == null && request.getVcRequestno()!=null){
			result = tyebpayinresultService.findByVcRequestno(request.getVcRequestno());
		}
		System.out.println(result);
		return result;
	}
}
